package User;

import BookList.Booklist;
import Operate.Deleteoperate;
import Operate.IO;
import Operate.*;

import java.util.Scanner;

/**
 * Created with Intellij IDEA.
 * Description;
 * User:墨琦
 * Data:2023-03-25
 * Time:9:54
 */
public class Administrators extends User{

   public Administrators() {
        ioperate=new IO[]{new Returnoperate() , new Findoperate(),new Addoperate(),
                new Deleteoperate(),new Showoperate()};
    }

    @Override
    public int menu() {
        System.out.println("**************管理员菜单*************");
        System.out.println("*****1.查找图书     2.添加图书********");
        System.out.println("*****3.删除图书     4.显示图书********");
        System.out.println("***********0.退出系统！**************");
        Scanner sc=new Scanner(System.in);
        System.out.println("你的选择——> ");
        int choice=sc.nextInt();
        while(true) {
            if (choice >= 5) {
                System.out.println("输入错误,重新选择");
                choice=sc.nextInt();
            }
            else break;
        }
        return choice;
    }
    public void Operation(int choice, Booklist book)
    {
        this.ioperate[choice].work(book);
    }
}
